package com.beasts.antpage.sh.service.impl;

import com.beasts.antpage.sh.entity.SysUserManage;
import com.beasts.antpage.sh.entity.User;
import com.beasts.antpage.sh.repository.SysUserManageRespository;
import com.beasts.antpage.sh.repository.UserRespository;
import com.beasts.antpage.sh.service.IAuthLoginService;
import com.crux.cloud.app.common.context.AppContext;
import com.crux.cloud.app.common.user.UserInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Locker
 * @date 28/05/2018 3:59 PM
 * @since 1.0
 */
@Service
public class AuthLoginService implements IAuthLoginService {

    private AppContext appContext;

    @Autowired
    private UserRespository userRespository;

    @Autowired
    private SysUserManageRespository sysUserManageRespository;

    @Override
    public User authLogin(String username, String password) {

        @NonNull
        User user = userRespository.findByUsername(username);

        return user;
    }

    @Override
    public User getUser(String username) {
        return userRespository.findByUsername(username);
    }

    @Override
    public SysUserManage findByUserId(String id) {
        return sysUserManageRespository.findByUserId(id);
    }

    @Override
    public SysUserManage saveUsermanage(SysUserManage sysUserManager) {
        return sysUserManageRespository.save(sysUserManager);
    }


}
